package com.supergzt.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.supergzt.entity.dos.Bill;
import com.supergzt.entity.vos.BillQueryVo;
import com.supergzt.service.BillService;
import com.supergzt.mapper.BillMapper;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;

/**
* @author 张钧的电脑
* @description 针对表【bill(账单)】的数据库操作Service实现
* @createDate 2023-03-30 09:11:39
*/
@Service
public class BillServiceImpl extends ServiceImpl<BillMapper, Bill>
    implements BillService{

	@Override
	public Page<Bill> queryBills(BillQueryVo billQueryVo, Page<Bill> page) {
		QueryWrapper<Bill> queryWrapper = new QueryWrapper<>();
		Integer type = billQueryVo.getType();
		if(type != null){
			queryWrapper.eq("type",type);
		}
		String typeName = billQueryVo.getTypeName();
		if(typeName != null){
			queryWrapper.eq("type_name",typeName);
		}
		LocalDate billTime = billQueryVo.getBillTime();
		if(billTime != null){
			queryWrapper.eq("bill_time",billTime);
		}
		return page(page,queryWrapper);
	}
}




